package com.windy.controller;

import com.windy.annotation.TokenAnnotation;
import com.windy.app.entity.User;
import com.windy.app.vo.Result;
import com.windy.app.vo.Token;
import com.windy.service.TokenService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("token")
public class TokenController {

    @Resource
    TokenService tokenService;

    @PostMapping("getToken")
    public Result<Token> getToken(@RequestBody User user){
        return new Result<Token>(true,"获取成功",tokenService.getToken());
    }
    @GetMapping("getToken1")
    public Result<Token> getToken1(@RequestBody User user){
        return new Result<Token>(true,"获取成功",tokenService.getToken());
    }

    @PostMapping("hallo")
    @TokenAnnotation
    public String hallo(){
        return "hallo";
    }

    @PostMapping("hallo1")
    public String hallo1(){
        return "hallo1";
    }
}
